{include file="Public/header" title="专业列表"/}
    <div  id="container" class="container-fluid">
      <div  class="row-fluid">
        <!-- 左侧导航栏 start -->
        {include file="Public/sidebar"/}
        <!-- 左侧导航栏 end -->
        <div id="content"  class="span10">
          <div  class="pageTit page-header">
            <h1>专业管理 </h1>
            <div  class="opt">
              <a  class="btn btn-info"  href="{:U('admin/major/add')}">添加专业</a>
            </div>
          </div>

          <div  class="dataBox">
            <table  class="table table-bordered table-striped center">
              <thead>
                <tr>
                  <th>专业ID</th>
                  <th>专业名称</th>
                  <th>添加时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
              {if condition="$major_list"}
                {foreach name="major_list" item="vo" }
                <tr id="tr_{$vo.Id}">
                  <td>{$vo.Id}</td>
                  <td>{$vo.name}</td>
                  <td>{$vo.add_time}</td>
                  <td>
                    <a title="编辑" class=" btn btn-mini btn-info js_edit" href="{:U("admin/major/edit?id=$vo[Id]")}">编辑</a>
                    <a title="删除" class=" btn btn-mini btn-danger js_del" id="{$vo.Id}">删除</a>
                  </td>
                </tr>
                {/foreach}
                {else/}
                <tr>
                  <td colspan="13">暂无相关专业信息</td>
                </tr>
                {/if}

              </tbody>
            </table>
          </div>
          {include file="Public/page"/}
        </div>
      </div>
    </div>
<script>
    $(function(){
      $('.btn-danger').click(function () {
        var result = confirm("删除是不可恢复的,你确认要删除吗?");
        if (!result) {
          return false;
        }
        else {
          var id = $(this).attr('id')
          $.ajax({
            type: "post",
            url: "__APP__/Admin/major/del",
            async: true,
            data: {Id: id},
            datatype: "json",
            success: function (data) {
              if (data.status == 1) {
                $("#tr_" + id).remove();
              }
              alert(data.data);
            },
            error: function () {
              alert("专业删除失败,请刷新重试");
            }
          });
        }
      });
    
    });
</script>    
{include file="Public/footer"/}